package com.ledi.guns.common.persistence.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.ledi.guns.common.persistence.model.BillClassMap;
import com.ledi.guns.common.persistence.model.vo.ClassInfoVo;

/**
 * <p>
 * 账单班级关系表 Mapper 接口
 * </p>
 *
 * @author zhongxp
 * @since 2018-08-22
 */
public interface BillClassMapMapper extends BaseMapper<BillClassMap> {

	void insertBatch(List<BillClassMap> billClassList);

	@Select("select ci.id  ,ci.`name`,ci.order_num orderNum  ,(select name from t_grade g where is_delete=0 and g.id=ci.grade_id) as gradeName from t_bill_class_map cm left JOIN t_class_info ci on ci.id =cm.class_id  where cm.bill_id=#{billId}")
	List<ClassInfoVo> selectByBillId(@Param("billId") Long billId);

}
